| Miles Sound System SDK 7.2a |
Read this section carefully if you plan to use Miles timer or other callbacks (such as an end-of-sample callback). If you don't intend to use callbacks, then this section won't apply to you.
On the PS2, callbacks are usually made to your application from an IOP interrupt handler. The ideal callback function is one that does nothing more than write to one or two flag variables and then immediately return back to Miles. At interrupt time on the PS2, certain operations are allowed but not recommended -- while other operations are forbidden altogether. The Sony documentation is the final authority here. (However, because Miles saves and restores the state of the floating-point unit at interrupt time, you can perform floating-point operations within Miles callback functions without difficulty.)
In any event, if you want to maintain portable code, you should read about the callback restrictions for the other platforms you intend to support.
Remember that all global or static variables that are modified by a callback function must be declared with the volatile modifier. Otherwise, the callback function and the foreground may not be able to communicate after the compiler has performed all of its optimizing tricks.
You should also minimize the total amount of work inside a Miles callback. During a callback, Miles is suspended, so other background tasks won't run - mixing will be interrupted, for example, if you take too long.
Again the best advice for callbacks is to simply post a message or set a flag that can be operated on by your foreground task. This technique works on all platforms and you'll never need to worry about the complications that multithreading or interrupts can cause.
Next Topic (Call Logging under PlayStation 2)
Previous Topic (Memory management under PlayStation 2)
Group:
Overview for Sony PlayStation 2
Related FAQs:
What's the deal with callbacks - are they threads, interrupts, system timers, or what?
For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.